//
//  FourthTableViewCell.m
//  On The Load
//
//  Created by 许嘉成 on 15/11/14.
//  Copyright © 2015年 @@叶一闽. All rights reserved.
//

#import "FourthTableViewCell.h"
#import "AppTools.h"
#import "XJCMusciModel.h"

@interface FourthTableViewCell()

@property(nonatomic,retain)UILabel *nameLabel;
@property(nonatomic,retain)UILabel *infoLabel;
@property(nonatomic,retain)UILabel *userLabel;

@end

@implementation FourthTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createCell];
    }
    return self;
}

-(void)createCell
{
    self.nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(10*WIDTH/375, 50*HEIGHT/667, WIDTH-10*2, 20*HEIGHT/667)];
    self.nameLabel.font = [UIFont systemFontOfSize:19];
    [self.contentView addSubview:self.nameLabel];
    
    UILabel *label1 = [[UILabel alloc]initWithFrame:CGRectMake(220*WIDTH/375, 20*HEIGHT/667, 40*WIDTH/375, 10*HEIGHT/667)];
    label1.text = @"音频由";
    label1.textColor = [UIColor colorWithWhite:0.600 alpha:1.000];
    label1.font = [UIFont systemFontOfSize:13*SCALEH];
    [self.contentView addSubview:label1];
    
    self.userLabel = [[UILabel alloc]initWithFrame:CGRectMake(label1.frame.origin.x+label1.frame.size.width, label1.frame.origin.y, 70*WIDTH/375, label1.frame.size.height)];
    self.userLabel.font = [UIFont systemFontOfSize:13*SCALEH];
    self.userLabel.textColor = [UIColor colorWithRed:0.545 green:0.902 blue:0.779 alpha:1.000];
    self.userLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.userLabel];
    
    UILabel *label2 = [[UILabel alloc]initWithFrame:CGRectMake(self.userLabel.frame.origin.x+self.userLabel.frame.size.width, self.userLabel.frame.origin.y, 30*WIDTH/375, self.userLabel.frame.size.height)];
    label2.text = @"上传";
    label2.font = [UIFont systemFontOfSize:13*SCALEH];
    label2.textColor  =[UIColor colorWithWhite:0.600 alpha:1.000];
    [self.contentView addSubview:label2];
    
    self.infoLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.nameLabel.frame.origin.x, self.nameLabel.frame.origin.y+self.nameLabel.frame.size.height+10, self.nameLabel.frame.size.width, 1500*HEIGHT/667)];
    //    self.infoLabel.backgroundColor = [UIColor colorWithRed:1.000 green:0.435 blue:0.812 alpha:1.000];
    self.infoLabel.textAlignment = NSTextAlignmentJustified;
    self.infoLabel.font = [UIFont systemFontOfSize:15*SCALEH];
    self.infoLabel.textColor = [UIColor colorWithWhite:0.400 alpha:1.000];
    self.infoLabel.numberOfLines = 0;
    [self.contentView addSubview:self.infoLabel];
    
    
}
-(void)setMusicM:(XJCMusciModel *)musicM
{
    _musicM = musicM;
    self.nameLabel.text = _musicM.name;
    self.infoLabel.text = _musicM.info;
    self.userLabel.text = [_musicM.user objectForKey:@"name"];
    //infoLabel内容自适应高度
    CGFloat height = [AppTools heightForCell:_musicM.info andwide:self.infoLabel.frame.size.width];
    //中间变量
    CGRect tempRect = self.infoLabel.frame;
    tempRect.size.height = height;
    self.infoLabel.frame = tempRect;
}

@end
